package com.huaxin.device.dto.request;

import com.huaxin.device.dto.enums.validation.ValidAlarmLevel;
import com.huaxin.device.dto.enums.validation.ValidAlarmType;
import com.huaxin.hxenum.validation.ValidDeviceType;
import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.NotNull;
import lombok.Builder;
import lombok.Data;

@Data
@Builder
public class DeviceAlarmCreateReqDTO {

    /**
     * 设备ID
     */
    @Schema(description = "设备ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "d123e456-789a-bcde-f012-3456789abcde")
    @NotBlank(message = "设备ID不能为空")
    private String deviceId;

    /**
     * 设备类型
     */
    @Schema(description = "设备类型", requiredMode = Schema.RequiredMode.REQUIRED, example = "circuit_breaker")
    @NotNull(message = "设备类型不能为空")
    @ValidDeviceType
    private String deviceType;

    /**
     * 报警类型
     */
    @Schema(description = "报警类型，指定监控表名", requiredMode = Schema.RequiredMode.REQUIRED, example = "over_current")
    @NotNull(message = "报警类型不能为空")
    @ValidAlarmType
    private String alarmType;

    /**
     * 报警等级
     */
    @Schema(description = "报警等级", requiredMode = Schema.RequiredMode.REQUIRED, example = "3")
    @NotNull(message = "报警等级不能为空")
    @ValidAlarmLevel
    private Integer alarmLevel;

    /**
     * 报警信息
     */
    @Schema(description = "报警信息", example = "电流超过阈值")
    private String alarmMessage;

    /**
     * 触发时的实际值
     */
    @Schema(description = "触发时的实际值", example = "15.6A")
    private String triggerValue;

    /**
     * 触发阈值
     */
    @Schema(description = "触发阈值", example = "12.0A")
    private String thresholdValue;

    /**
     * 阈值规则ID
     */
    @Schema(description = "阈值规则ID", example = "r123e456-789a-bcde-f012-3456789abcde")
    private String ruleId;

    /**
     * 持续时间（秒）
     */
    @Schema(description = "持续时间（秒）", example = "30")
    private Integer durationSec;

    /**
     * 组织ID
     */
    @Schema(description = "组织ID", example = "org_001")
    private String orgId;

    /**
     * 家族ID
     */
    @Schema(description = "家族ID", example = "family_001")
    private String familyId;
}